/*
@author: stanfor
@date: 2022/8/22 18:02
@Version: 1.0
@last modify time : 2022/8/22 18:02
*/

import React, { FC, ReactElement } from 'react';
import { Radio, Col, Form, RadioProps } from 'antd';
import { getRulesConfig, commonInterface } from '@C/base/SFields/constant';
import './index.less';

const Index: FC<Partial<commonInterface> & Partial<RadioProps>> = (props): ReactElement => {
  const { name, label = 'Radio', span = 8, required = false, ruleIcon, formItemConfig, ...radioProps } = props;

  return (
    <Col span={span}>
      <div className="base-component-super-fields-common">
        <Form.Item
          name={name}
          rules={getRulesConfig(required, label, ruleIcon, `未勾选${label}`)}
          {...formItemConfig}
        >
          <Radio {...radioProps}>{ label }</Radio>
        </Form.Item>
      </div>
    </Col>
  );
};

export default Index;
